﻿using Microsoft.AspNetCore.Mvc;
using PaymentService.Services;
using PaymentService.Services.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace PaymentService.Controllers;

[Route("api/paymentservice/[action]")]
public class PaymentController : AbpController, IPaymentService
{
    public IPaymentService paymentService { get; set; }

    public PaymentController()
    {

    }

    [HttpPost]
    public async Task<PaymentDto> CreateAsync(PaymentDto input)
    {
        return await paymentService.CreateAsync(input);
    }

    [HttpDelete]
    public async Task DeleteAsync(Guid id)
    {
        await paymentService.DeleteAsync(id);
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [HttpGet]
    public async Task<PaymentDto> GetAsync(Guid id)
    {
        return await paymentService.GetAsync(id);
    }

    /// <summary>
    /// 获取
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<PagedResultDto<PaymentDto>> GetListAsync(PagedAndSortedResultRequestDto input)
    {
        return await paymentService.GetListAsync(input);
    }

    /// <summary>
    /// 修改
    /// </summary>
    /// <param name="id"></param>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPut]
    public async Task<PaymentDto> UpdateAsync(Guid id, PaymentDto input)
    {
        return await paymentService.UpdateAsync(id, input);
    }

    /// <summary>
    /// 支付宝或者微信支付的接口
    /// </summary>
    /// <param name="createOrderPayDto"></param>
    /// <returns></returns>
    /// <exception cref="NotImplementedException"></exception>
    [HttpPost]
    public async Task<OrderPayDto> CreateOrderPayAsync(CreateOrderPayDto createOrderPayDto)
    {
        return await paymentService.CreateOrderPayAsync(createOrderPayDto);
    }
}
